package com.gitee.huxing.course.conc.conc02.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @Description:
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.conc.conc02.threadpool
 * @ClassName: ExceptionDemo
 * @Author: huxing
 * @DateTime: 2021-08-25 下午2:22
 */
public class ExceptionDemo {

    public static void main(String[] args) {

        ExecutorService executorService = Executors.newFixedThreadPool(1);

        try {
            Future<Double> future = executorService.submit(()->{
                throw new RuntimeException("executorService.submit");
            });
            double b = future.get();
            System.out.println(b);
        } catch (Exception ex){
            System.out.println("catch submit");
            ex.printStackTrace();
        }

        executorService.shutdown();
        System.out.println("Main Thread End");
    }
}
